package com.yhb.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;

import java.math.BigDecimal;
import java.util.Date;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class ChannelFlow {
    private String id;
    private String planId;
    private Date executionTime;
    private BigDecimal amount;
    private String cardId;
    private Type type;
    private BigDecimal commission; // 手续费
    private BigDecimal remitFee; // 代付费
    private Status status = Status.PENDING;

    @JsonIgnore
    private String executionId;

    @JsonIgnore
    private String localization;
    public enum Type {
        CONSUME, // 消费
        REMIT // 还款 / 代付
    }

    // PENDING --> EXECUTING --> TERMINATED
    //                       --> SUCCEED
    //                             ^     // 这一状态变化仅发生在代付单上
    //                       --> FAILED
    public enum Status {
        PENDING,
        EXECUTING,
        TERMINATED,
        SUCCEED,
        FAILED
    }
}
